package cool.taomu.toolkit.platform.modules

import com.google.common.reflect.TypeToken
import com.google.inject.AbstractModule
import com.google.inject.TypeLiteral
import com.google.inject.name.Names
import cool.taomu.toolkit.cacheable.GuavaCacheService
import cool.taomu.toolkit.cacheable.ICacheService
import cool.taomu.toolkit.platform.entity.CrumbsEntity
import cool.taomu.toolkit.platform.entity.MenuEntity
import java.util.ArrayList
import java.util.List
import org.slf4j.LoggerFactory

class PlatformModule extends AbstractModule {
    val static LOG = LoggerFactory.getLogger(PlatformModule);
    override configure() {
        
        LOG.info("加载平台配置")
        
        //bind(ICacheService).to(GuavaCacheService);
        bind(TypeToken).annotatedWith(Names.named("taomu.menu.type")).toInstance(new TypeToken<MenuEntity>() {
        })
        bind(new TypeLiteral<List<Object>>() {
        }).annotatedWith(Names.named("taomu.menu.list")).toInstance(new ArrayList<Object>());
        bind(TypeToken).annotatedWith(Names.named("taomu.crumbs.type")).toInstance(new TypeToken<CrumbsEntity>() {
        })
        bind(new TypeLiteral<List<Object>>() {
        }).annotatedWith(Names.named("taomu.crumbs.list")).toInstance(new ArrayList<Object>());
    }
}
